package com.gok.controller.index;

import com.gok.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @author: Administrator
 * @create time: 2020/12/21 10:52
 * @description:  起始加载控制器
 */
@Controller
public class IndexController {
    @Autowired
    private UserService userService;

    //去往登录页面
    @RequestMapping({"/","/init.do"})
    public String init(HttpServletRequest req){
        //获取项目路径
        req.getSession().setAttribute("appPath",req.getContextPath());

        //初始化查询全部用户信息，并加入到redis缓存
        userService.findAllUser();
        return "html/loginPage/login";
    }

    //去往滑块验证页面
    @RequestMapping("/toSlider")
    public String toSlider(){
        return "html/loginPage/checkSlider";
    }


    //去往左侧首页菜单
    @RequestMapping("/toMainList")
    public String toMainList(){
        return "html/menu/main_list";
    }


    //去往首页home
    @RequestMapping("/toHome")
    public String toHome(){
        return "html/indexPage/home";
    }
}
